package com.dili.dd.gpi.mapper;

import com.dili.dd.gpi.domain.UidNameSpace;
import com.dili.dd.gpi.domain.UidNameSpaceExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface UidNameSpaceMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    int countByExample(UidNameSpaceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    int deleteByExample(UidNameSpaceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    @Delete({
        "delete from uid_name_space",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    @Insert({
        "insert into uid_name_space (name_space, `level`, ",
        "`type`, ",
        "current_value, create_time, ",
        "update_time)",
        "values (#{nameSpace,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, ",
        "#{type,jdbcType=VARCHAR,typeHandler=org.apache.ibatis.type.EnumTypeHandler}, ",
        "#{currentValue,jdbcType=INTEGER}, #{createTime,jdbcType=DATE}, ",
        "#{updateTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(UidNameSpace record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    int insertSelective(UidNameSpace record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    List<UidNameSpace> selectByExample(UidNameSpaceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    @Select({
        "select",
        "id, name_space, `level`, `type`, current_value, create_time, update_time",
        "from uid_name_space",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    UidNameSpace selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    int updateByExampleSelective(@Param("record") UidNameSpace record, @Param("example") UidNameSpaceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    int updateByExample(@Param("record") UidNameSpace record, @Param("example") UidNameSpaceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    int updateByPrimaryKeySelective(UidNameSpace record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table uid_name_space
     *
     * @mbggenerated Tue Aug 25 11:38:36 CST 2015
     */
    @Update({
        "update uid_name_space",
        "set name_space = #{nameSpace,jdbcType=VARCHAR},",
          "`level` = #{level,jdbcType=VARCHAR},",
          "`type` = #{type,jdbcType=VARCHAR,typeHandler=org.apache.ibatis.type.EnumTypeHandler},",
          "current_value = #{currentValue,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=DATE},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(UidNameSpace record);
}